<?php
$this->breadcrumbs=array(
	'Categories'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'Create Category', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('category-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<h1>Manage Categories</h1>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'category-grid',
	'cssFile' => false,
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'name' => 'id',
			'htmlOptions' => array('width' => '35'),
			'type' => 'number'
		),
		array(
			'header' => '上一级',
			'value' => '($data->parent) ? $data->parent->name : ""'
		),
		'name',
		array(
		    'name' => 'publish',
		    'type' => 'html',
		    'value' => 'CHtml::link(($data->publish) ? "Y" : "N", Yii::app()->getController()->createUrl("publish", array("id" => $data->id)))',
		),
		array(
			'class'=>'CButtonColumn',
			'template' => '{update} {delete}'
		),
	),
)); ?>
